from codeagent import CodeAgent

agent = CodeAgent()
print('测试工具调用功能...')

# 测试代码执行工具
result = agent.code_tools.executeTool('code_execute', {
    'code': 'print("Hello from CodeAgent!"); x = 5 + 3; print(f"5 + 3 = {x}")',
    'language': 'python'
})

print('代码执行结果:')
print('成功:', result['success'])
print('输出:', result['stdout'])
if result['stderr']:
    print('错误:', result['stderr'])